package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpYAccountUserProfileChangePasswordTabPageUtil extends SeleniumPageUtil {
	public final static By UPCP_SPAN_HEADER = By.id("ctl44_ParentChildContainer_UserProfile_Password1_hdrMain_lblHeader");
	public final static By UPCP_TD_PASSWORD = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr[1]/td[1]");
	public final static By UPCP_INPUT_PASSWORD = By.id("ctl44_ParentChildContainer_UserProfile_Password1_txtPassword");
	public final static By UPCP_TD_CONFIRM = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr[2]/td[1]");
	public final static By UPCP_INPUT_CONFIRM = By.id("ctl44_ParentChildContainer_UserProfile_Password1_txtConfirm");
	public final static By UPCP_INPUT_SUBMIT = By.id("ctl44_ParentChildContainer_UserProfile_Password1_cmdSubmit");
	
	public static void enterUserProfileChangePasswordPage(){
		SpYAccountUserProfileDefaultPageUtil.enterYourAccountUserProfileDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpYAccountUserProfileDefaultPageUtil.YAUP_TAB_CHANGE_PASSWORD));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				UPCP_SPAN_HEADER, UPCP_TD_PASSWORD, UPCP_TD_CONFIRM, UPCP_INPUT_SUBMIT
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPCP_SPAN_HEADER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPCP_TD_PASSWORD));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPCP_TD_CONFIRM));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPCP_INPUT_SUBMIT));
	}
}
